#include <opencv2\opencv.hpp>
using namespace cv;
int main()
{
	Mat img = imread("perspective.jpg");
	Mat dst;
	Mat pts1 = (Mat_<float>(4, 2) << 290, 139, 362, 121, 331, 209, 409, 191);
	Mat pts2 = (Mat_<float>(4, 2) << 0, 0, 300, 0, 0, 300, 300, 300);
	Mat M = getPerspectiveTransform(pts1, pts2);
	warpPerspective(img, dst, M, Size(300, 300));
	imshow("img", img);
	imshow("dst", dst);
	waitKey(0);
	return 0;
}